package com.jiazhong.shopping.servlets;

import com.jiazhong.shopping.dao.ShowTableDao;
import com.jiazhong.shopping.dao.impl.ShowTableDaoImpl;
import com.jiazhong.shopping.model.Table;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author hyhWTX
 * @version 1.0
 * @ClassName ShowTableSrevlet
 * @date 2022年06月17日 11:19
 * @Description: TODO (一句话描述以下该类的功能)
 */
@WebServlet("/showTable")
public class ShowTableServlet extends HttpServlet {
    ShowTableDao showTableDao = new ShowTableDaoImpl();
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Table> tables = showTableDao.find();
        HttpSession session = request.getSession();
        session.setAttribute("tables",tables);
        response.sendRedirect("showTable.jsp");

    }
}
